xenconsoled: fix timestamp log
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 10:27:54 +0000 (11:27 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Jun 2009 10:27:54 +0000 (11:27 +0100)
timestamp log is broken.
Also, xenconsoled might die with segfault.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
tools/console/daemon/io.c

index 11e0950595953a221e04e25c1606d4c0b0f10b3e..67fb22c612e82dd21c9ed5f79e4dda58e7018deb 100644 (file)
@@ -127,7 +127,7 @@ static int write_with_timestamp(int fd, const char *data, size_t sz,
        const char *last_byte = data + sz - 1;
 
        while (data <= last_byte) {
-               const char *nl = memchr(data, '\n', sz);
+               const char *nl = memchr(data, '\n', last_byte + 1 - data);
                int found_nl = (nl != NULL);
                if (!found_nl)
                        nl = last_byte;